package com.resou.reader.reader.adpter;

import android.support.annotation.Nullable;
import android.support.v7.widget.CardView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.resou.reader.R;

import java.util.List;

public class ReadBgAdapter extends BaseQuickAdapter<Integer, BaseViewHolder> {
    private int mPosition;

    public ReadBgAdapter(@Nullable List<Integer> data) {
        super(R.layout.item_read_gb, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Integer item) {
       CardView cardView= helper.getView(R.id.bgView);
       cardView.setCardBackgroundColor(item);
        helper.setVisible(R.id.viewSelect, mPosition==helper.getAdapterPosition());
    }
    public void setSelect(int position){
        mPosition = position;
       notifyDataSetChanged();
    }
}
